package com.lyt.springboot.util.algorithm;

public class S12 {
    public String solve(String str) {
//        StringBuilder builder = new StringBuilder(str);
//        return builder.reverse().toString();

        //双指针
        char[] chars = str.toCharArray();
        int left = 0;
        int right = chars.length - 1;
        while (left < right) {
            char temp = chars[left];
            chars[left] = chars[right];
            chars[right] = temp;
            left++;
            right--;
        }
        return new String(chars);
    }

    public static void main(String[] args) {
        char[] c = {'a','b','3'};
        String s = new String(c);
        System.out.println(s);
    }
}
